include config/kern.conf

BASEDIR		= ./kern
 
DIRS		= ${BASEDIR}
#LDFLAGS=	--oformat binary -Ttext 0xC0200000
LDFLAGS		= -melf_i386 -nostdlib -nostdinc -no-builtin -no-exceptions -Ttext 0xC0200000
OBJFILES	= ${BASEDIR}/*.o


${KERNAME}:
	for dir in ${DIRS};do make -C $$dir;done
	ld ${OBJFILES} ${LDFLAGS} -o ${KERNAME}
	make -C ${BASEDIR}/arch/${ARCH}/boot
	cat /usr/share/grub/i386-redhat/stage1 /usr/share/grub/i386-redhat/stage2 pad start.bin pad2 > floppy.img

install: ${KERNAME}
	${CP} ${KERNAME} ${BASEDIR}/../../bin
	${CP} ${BOOTIMG} ${BASEDIR}/../../bin

clean:
	if [ -f ${KERNAME} ]; then ${RM} ${KERNAME}; fi
	for dir in ${DIRS};do make clean -C $$dir;done

tar:
	tar -cjf ../${KERNAME}.tar.bz2 ../sirena

